package com.hanamaki.study.day02.paramtersBroswer;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.edge.EdgeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Parameters;
import org.testng.annotations.Test;

public class TestMultiBrowser {

    /* WebDriver 代表 浏览器 对象 */
    WebDriver driver;

    @BeforeClass
    @Parameters("Browser")
    public void setUp(String Browser) {
        if (Browser.equalsIgnoreCase("Firefox")) {
            /* 1. 注册驱动的位置  */
            System.setProperty("webdriver.gecko.driver", "C:\\Program Files\\Mozilla Firefox\\geckodriver.exe");

            /* 2, 注册驱动 */
            driver = new FirefoxDriver();
        } else if (Browser.equalsIgnoreCase("Chrome")) {
            /* 1. 注册驱动的位置  */
            System.setProperty("webdriver.chrome.driver", "C:\\Program Files\\Google\\Chrome\\Application\\chromedriver.exe");

            /* 2, 注册驱动 */
            driver = new ChromeDriver();
        } else if (Browser.equalsIgnoreCase("edge")) {
            /* 1. 注册驱动的位置  */
            System.setProperty("webdriver.edge.driver", "C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\msedgedriver.exe");

            /* 2, 注册驱动 */
            driver = new EdgeDriver();

        }


    }

    @Test
    public void firefox() {
        /* 打开网址测试  */
        driver.get("https://www.baidu.com");


    }




}
